﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Database;
using System.Reflection;

namespace Flexfield
{
    public partial class FrmConfigurarFlexField : Form
    {
        public FrmConfigurarFlexField()
        {
         InitializeComponent();
        }
    
       private void FrmConfigurarFlexField_Load(object sender, EventArgs e)
       {
          
           

        // Obtenemos una referencia al ensamblado actual
        
         
           InitializeComponent();
        //Dim asm As Assembly = Reflection.Assembly.GetExecutingAssembly

        //Dim n As Integer

        //For Each ty As Type In asm.GetTypes

        //    ' Obtenemos el nombre del tipo del que hereda
        //    ' directamente el objeto System.Type actual. 
        //    '
        //    If ty.BaseType.Name = "Form" Then n += 1

        //Next

        //MessageBox.Show("Nº de formularios: " & CStr(n))

       }

       public void Forms(Assembly Origen)
       {
           
           //Assembly asm = Assembly.GetExecutingAssembly();
           Form Frm;

           
           Dictionary<string,Form> Ins = new Dictionary<string,Form>();

           foreach (Type ty in Origen.GetTypes())
           {
               if (ty.BaseType.Name == "Form")
                   Frm = (Form)Activator.CreateInstance(null, ty.Name).Unwrap();


               //foreach (Control ctrl in Frm.Controls)
               //{
               //    if (ctrl is Flexfield)
               //        cmbForms.Items.Add(ty.Name);

               //}

          

           }

       }

       private void FrmConfigurarFlexField_FormClosing(object sender, FormClosingEventArgs e)
       {
          
       }

       private void cmbForms_SelectedIndexChanged(object sender, EventArgs e)
       {

       }

       private void cmbForms_Click(object sender, EventArgs e)
       {
        
       }
    }
}
